/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import AO.Course;
import dbconnector.DBDriver;
import java.sql.PreparedStatement;

/**
 *
 * @author FRIENDS
 */
public class CourseDAO 
{
 public static boolean save(Course course) throws Exception
     {
      try
      {
      PreparedStatement pstmt = DBDriver.getPrepare("insert into course values(?,?,?,?,?,?,?)");
      pstmt.setString(1, course.getCourseId());
      pstmt.setString(2, course.getCourseName());
      pstmt.setString(3, course.getSdate());
      pstmt.setString(4, course.getEdate());
      pstmt.setInt(5, course.getFee());
      pstmt.setInt(6, course.getNoofFaculty());
      pstmt.setInt(7, course.getNoofExams());
      System.out.println("bean added not commited");
      int i=pstmt.executeUpdate();
      if(i==1)
      {  System.out.println("bean added");
          return true;
      }
    }catch(Exception e){return false;}
      return false;
     }    
}
